***Fortin-Rittberger
***replication commands for Jessica Fortin-Rittberger. 2016. "Cross-national gender-gaps in political knowledge: how much is due to context?"
*** Political Research Quarterly
********MAKING THE VARIABLES NEEDED FROM MERGED RAW CSES DATASET
********PREPARED BY JESS F-R 2015-07-14
********NOTE left coding for Module 4 with * in case we change our minds and want to bring these back
********File arranged as individual (structure)



***making merged variables
***identifier
tab A1003
tab B1003
tab C1003
*tab D1003
generate Z1001=.
replace Z1001=1 if A1003~=.
replace Z1001=2 if B1003~=.
replace Z1001=3 if C1003~=.
*replace Z1001=4 if D1003~=.
label variable Z1001 "CSES Module"
tab Z1001

***polity year identifyer string
generate Z1004=A1004
replace Z1004=B1004 if B1003~=.
replace Z1004=C1004 if C1003~=.
*replace Z1004=D1004 if D1003~=.
label variable Z1004 "ID VARIABLE - ELECTION STUDY ALPHA POLITY"
tab Z1004

**mode of interview
tab A1023 if A1003~=., mis
tab B1023 if B1003~=., mis
tab C1023 if C1003~=., mis
generate Z1023=.
replace Z1023 =A1023 if A1003~=.
replace Z1023 =B1023 if B1003~=.
replace Z1023 =C1023 if C1003~=.
label variable Z1023 "SURVEY MODE"
label define mode 1 "Face to Face" 2 "telephone" 3 "self-administered" 4 "combination phone + self-admin" 5 "combination face to face + self administered"
label values Z1023 mode
tab Z1023, m


*interviewer ID
*tab A1024 if A1003~=., mis
*tab B1024 if B1003~=., mis
*tab C1024 if C1003~=., mis
mvdecode B1024, mv (99999)
mvdecode C1024, mv (999999)
generate Z1024=.
**adding a contant to avoid duplicates
replace Z1024 = 1000000 + A1024 if A1003~=.
replace Z1024 = 2000000 + B1024 if B1003~=.
replace Z1024 = 3000000 + C1024 if C1003~=.
label variable Z1024 "INTERVIEWER WITHIN ELECTION STUDIES"
*tab Z1024, m


***interviewer gender 
tab A1025 if A1003~=., mis
tab B1025 if B1003~=., mis
tab C1025 if C1003~=., mis
***shoot 75% missing 
generate Z1025=.
replace Z1025 =A1025 if A1003~=.
replace Z1025 =B1025 if B1003~=.
replace Z1025 =C1025 if C1003~=.
mvdecode Z1025, mv(9)
label variable Z1025 "INTERVIEWER GENDER 1. male, 2. female"
label define gender 1 "male" 2 "female"
label values Z1025 gender
tab Z1025, m


***now tackling some demographics, module 4 different
***age
mvdecode A2001, mv(997, 998, 999)
mvdecode A2001, mv(1, 2, 3, 4)
tab A2001
mvdecode B2001, mv(997, 998, 999)
tab B2001
mvdecode C2001, mv(997, 998, 999)
tab C2001
*mvdecode D2001_Y, mv(9997, 9998, 9999)
*mvdecode D1028, mv(9999)
*generate D2001=D1028-D2001_Y
*tab D2001

generate Z2001=.
replace Z2001=A2001 if A1003~=.
replace Z2001=B2001 if B1003~=.
replace Z2001=C2001 if C1003~=.
*replace Z2001=D2001 if D1003~=.
label variable Z2001 "AGE"
tab Z2001, missing
****problem with range!!! we have values 1-4
mvdecode Z2001, mv(1,2,3,4)
*mvdecode Z2001, mv(997, 998, 999)
*drop D2001
tab Z2001, missing

***gender
tab A2002
tab B2002
tab C2002
*tab D2002
generate Z2002=.
replace Z2002=A2002 if A1003~=.
replace Z2002=B2002 if B1003~=.
replace Z2002=C2002 if C1003~=.
*replace Z2002=D2002 if D1003~=.
label variable Z2002 "GENDER, women==2"
label values Z2002 gender
***male 1 female 2
***missings
mvdecode Z2002, mv(7,9)
tab Z2002, missing

***Education
tab A2003
tab B2003
tab C2003
*tab D2003
*generate D2003b=D2003
*recode D2003b (9=8)
generate Z2003=.
replace Z2003=A2003 if A1003~=.
replace Z2003=B2003 if B1003~=.
replace Z2003=C2003 if C1003~=.
*replace Z2003=D2003b if D1003~=.
label variable Z2003 "EDUCATION"
tab Z2003
***missing and complicated cases
mvdecode Z2003, mv(9, 96, 97, 98, 99)
tab Z2003, missing
*drop D2003b
***importing value labels from the CSES
label define C2003_   1 "1. NONE"   , add
label define C2003_   2 "2. INCOMPLETE PRIMARY"   , add
label define C2003_   3 "3. PRIMARY COMPLETED"   , add
label define C2003_   4 "4. INCOMPLETE SECONDARY"   , add
label define C2003_   5 "5. SECONDARY COMPLETED"   , add
label define C2003_   6 "6. POST-SECONDARY TRADE / VOCATIONAL SCHOOL"   , add
label define C2003_   7 "7. UNIVERSITY UNDERGRADUATE DEGREE INCOMPLETE"   , add
label define C2003_   8 "8. UNIVERSITY UNDERGRADUATE DEGREE COMPLETED"   , add
label define C2003_   9 "9. [SEE VARIABLE NOTES]"   , add
label define C2003_   97 "97. REFUSED"   , add
label define C2003_   98 "98. DON'T KNOW"   , add
label define C2003_   99 "99. MISSING"   , add
label values Z2003 C2003_


***string command
*gen str8 C1003s = C1003      // would be Slovenia (705 + 0) 2008
*destring C1003s, gen(xC1003)
*drop C1003s

***marital status
tab A2004
tab B2004
tab C2004
*tab D2004
generate Z2004=.
replace Z2004=A2004 if A1003~=.
replace Z2004=B2004 if B1003~=.
replace Z2004=C2004 if C1003~=.
*replace Z2004=D2004 if D1003~=.
label variable Z2004 "MARITAL STATUS 1=MARRIED"
tab Z2004
***missing and complicated cases
mvdecode Z2004, mv(5, 6, 7, 8, 9)
label define C2004_   1 "1. MARRIED OR LIVING TOGETHER AS MARRIED"   , add
label define C2004_   2 "2. WIDOWED"   , add
label define C2004_   3 "3. DIVORCED OR SEPARATED"   , add
label define C2004_   4 "4. SINGLE, NEVER MARRIED"   , add
label define C2004_   5 "5. [SEE VARIABLE NOTES]"   , add
label define C2004_   7 "7. REFUSED"   , add
label define C2004_   8 "8. DON'T KNOW"   , add
label define C2004_   9 "9. MISSING"   , add
label values Z2004 C2004_
tab Z2004, missing

***union membership
tab A2005
tab B2005
tab C2005
*tab D2005
generate Z2005=.
replace Z2005=A2005 if A1003~=.
replace Z2005=B2005 if B1003~=.
replace Z2005=C2005 if C1003~=.
*replace Z2005=D2005 if D1003~=.
label variable Z2005 "UNION MEMBERSHIP"
tab Z2005
***missing and complicated cases
mvdecode Z2005, mv(7, 8, 9)
label values Z2005 C2005_
label define C2005_   1 "1. R IS MEMBER OF A UNION"   , add
label define C2005_   2 "2. R IS NOT A MEMBER OF A UNION"   , add
label define C2005_   7 "7. REFUSED"   , add
label define C2005_   8 "8. DON'T KNOW"   , add
label define C2005_   9 "9. MISSING"   , add
tab Z2005, missing

****Currernt employment status"
tab A2007
tab B2010
tab C2010
*tab D2010
generate Z2007=.
replace Z2007=A2007 if A1003~=.
replace Z2007=B2010 if B1003~=.
replace Z2007=C2010 if C1003~=.
*replace Z2007=D2010 if D1003~=.
label variable Z2007 "CURRENT EMPLOYMENT STATUS"
tab Z2007
***missing and complicated cases
mvdecode Z2007, mv(11, 12, 97, 98, 99)
label define C2010_   1 "1. EMPLOYED: FULL-TIME (32+ HOURS WEEKLY)"   , add
label define C2010_   2 "2. EMPLOYED: PART-TIME (15-32 HOURS WEEKLY)"   , add
label define C2010_   3 "3. EMPLOYED: LESS THAN 15 HOURS"   , add
label define C2010_   4 "4. HELPING FAMILY MEMBER"   , add
label define C2010_   5 "5. UNEMPLOYED"   , add
label define C2010_   6 "6. STUDENT, IN SCHOOL, IN VOCATIONAL TRAINING"   , add
label define C2010_   7 "7. RETIRED"   , add
label define C2010_   8 "8. HOUSEWIFE, HOME DUTIES"   , add
label define C2010_   9 "9. PERMANENTLY DISABLED"   , add
label define C2010_   10 "10. OTHERS, NOT IN LABOR FORCE"   , add
label define C2010_   11 "11. [SEE VARIABLE NOTES]"   , add
label define C2010_   12 "12. [SEE VARIABLE NOTES]"   , add
label define C2010_   97 "97. REFUSED"   , add
label define C2010_   98 "98. DON'T KNOW"   , add
label define C2010_   99 "99. MISSING"   , add
label values Z2007 C2010_
tab Z2007, missing

***income
tab A2012
tab B2020
tab C2020
*tab D2020
generate Z2020=.
replace Z2020=A2012 if A1003~=.
replace Z2020=B2020 if B1003~=.
replace Z2020=C2020 if C1003~=.
*replace Z2020=D2020 if D1003~=.
label variable Z2020 "INCOME QUINTILES"
tab Z2020
***missing and complicated cases
mvdecode Z2020, mv(6, 7, 8, 9)
label define C2020_   1 "1. LOWEST HOUSEHOLD INCOME QUINTILE"   , add
label define C2020_   2 "2. SECOND HOUSEHOLD INCOME QUINTILE"   , add
label define C2020_   3 "3. THIRD HOUSEHOLD INCOME QUINTILE"   , add
label define C2020_   4 "4. FOURTH HOUSEHOLD INCOME QUINTILE"   , add
label define C2020_   5 "5. HIGHEST HOUSEHOLD INCOME QUINTILE"   , add
label define C2020_   6 "6. [SEE VARIABLE NOTES]"   , add
label define C2020_   7 "7. REFUSED"   , add
label define C2020_   8 "8. DON'T KNOW"   , add
label define C2020_   9 "9. MISSING"   , add
label values Z2020 C2020_
tab Z2020, missing

***religious service attendence
tab A2015
tab B2023
tab C2023
*tab D2024
generate Z2023=.
replace Z2023=A2015 if A1003~=.
replace Z2023=B2023 if B1003~=.
replace Z2023=C2023 if C1003~=.
*replace Z2023=D2024 if D1003~=.
label variable Z2023 "RELIGIOUS SERVICE ATTENDENCE"
tab Z2023, missing
***missing and complicated cases
mvdecode Z2023, mv(7, 8, 9)
label define C2023_   1 "1. NEVER"   , add
label define C2023_   2 "2. ONCE A YEAR"   , add
label define C2023_   3 "3. TWO TO ELEVEN TIMES A YEAR"   , add
label define C2023_   4 "4. ONCE A MONTH"   , add
label define C2023_   5 "5. TWO OR MORE TIMES A MONTH"   , add
label define C2023_   6 "6. ONCE A WEEK"   , add
label define C2023_   7 "7. REFUSED"   , add
label define C2023_   8 "8. DON'T KNOW"   , add
label define C2023_   9 "9. MISSING"   , add
label values Z2023 C2023_
tab Z2023, missing

***religiosity
tab A2016
tab B2024
tab C2024
*tab D2025
generate Z2024=.
replace Z2024=A2016 if A1003~=.
replace Z2024=B2024 if B1003~=.
replace Z2024=C2024 if C1003~=.
*replace Z2024=D2025 if D1003~=.
label variable Z2024 "RELIGIOSITY"
tab Z2024, missing
***missing and complicated cases
mvdecode Z2024, mv(7, 8, 9)
label define C2024_   1 "1. HAVE NO RELIGIOUS BELIEFS"   , add
label define C2024_   2 "2. NOT VERY RELIGIOUS"   , add
label define C2024_   3 "3. SOMEWHAT RELIGIOUS"   , add
label define C2024_   4 "4. VERY RELIGIOUS"   , add
label define C2024_   7 "7. REFUSED"   , add
label define C2024_   8 "8. DON'T KNOW"   , add
label define C2024_   9 "9. MISSING"   , add
label values Z2024 C2024
tab Z2024, missing

***rural or urban
tab A2022
tab B2030
tab C2030
generate Z2030=.
replace Z2030=A2022 if A1003~=.
replace Z2030=B2030 if B1003~=.
replace Z2030=C2030 if C1003~=.
label variable Z2030 "RURAL OR URBAN RESIDENCE"
tab Z2030
***missing and complicated cases
mvdecode Z2030, mv(7, 8, 9)
label define C2030_   1 "1. RURAL AREA OR VILLAGE"   , add
label define C2030_   2 "2. SMALL OR MIDDLE-SIZED TOWN"   , add
label define C2030_   3 "3. SUBURBS OF LARGE TOWN OR CITY"   , add
label define C2030_   4 "4. LARGE TOWN OR CITY"   , add
label define C2030_   7 "7. REFUSED"   , add
label define C2030_   8 "8. DON'T KNOW"   , add
label define C2030_   9 "9. MISSING"   , add
label values Z2030 C2030_
tab Z2030


***EFFICACY: who is in power makes a difference
****different coding module 3 reverse!!
tab A3028
tab B3013
tab C3004
generate C3004b=.
replace C3004b=5 if C3004==1
replace C3004b=4 if C3004==2
replace C3004b=3 if C3004==3
replace C3004b=2 if C3004==4
replace C3004b=1 if C3004==5
tab C3004b

generate Z3000=.
replace Z3000=A3028 if A1003~=.
replace Z3000=B3013 if B1003~=.
replace Z3000=C3004b if C1003~=.
label variable Z3000 "WHO IS IN POWER CAN MAKE A DIFFERENCE"
tab Z3000
***missing and complicated cases
mvdecode Z3000, mv(7, 8, 9)
label values Z3000 B3013_
tab Z3000
drop C3004b

***who people vote for makes a difference
tab A3029
tab B3014
tab C3005
generate Z3001=.
replace Z3001=A3029 if A1003~=.
replace Z3001=B3014 if B1003~=.
replace Z3001=C3005 if C1003~=.
label variable Z3001 "WHO PEOPLE VOTE FOR CAN MAKE A DIFFERENCE"
tab Z3001
***missing and complicated cases
mvdecode Z3001, mv(7, 8, 9)
label define C3005_   1 "1. WHO PEOPLE VOTE FOR WON'T MAKE A DIFFERENCE"   , add
label define C3005_   5 "5. WHO PEOPLE VOTE FOR CAN MAKE A DIFFERENCE"   , add
label define C3005_   7 "7. REFUSED"   , add
label define C3005_   8 "8. DON'T KNOW"   , add
label define C3005_   9 "9. MISSING"   , add
label values Z3001 C3005_
tab Z3001


***satisfaction with democracy
tab A3001
tab B3012
tab C3019
***watch it, module 1 and 3 are coded 1245 rather than 1234!!
generate A3001_2=A3001
recode A3001_2  (3=9)
recode A3001_2  (4=3)
recode A3001_2  (5=4)
generate C3019_2=C3019
recode C3019_2 (4=3)
recode C3019_2 (5=4)
***now the variable with the corrected values
generate Z3019=3
replace Z3019=A3001_2 if A1003~=.
replace Z3019=B3012 if B1003~=.
replace Z3019=C3019_2 if C1003~=.
label variable Z3019 "SATISFACTION WITH DEMOCRACY"
label values Z3019 B3012_
tab Z3019
drop C3019_2
drop A3001_2 
***missing and complicated cases
mvdecode Z3019, mv(6, 7, 8, 9)
tab Z3019

***close to a political party
tab A3004
tab B3028
tab C3020_1
generate Z3020=.
****watch it with yes no codes 1/5
replace Z3020=A3004 if A1003~=.
replace Z3020=B3028 if B1003~=.
replace Z3020=C3020_1 if C1003~=.
label define C3020   1 "1. YES"   , replace
label define C3020   5 "5. NO"   , add
label define C3020   7 "7. REFUSED"   , add
label define C3020   8 "8. DON'T KNOW"   , add
label define C3020   9 "9. MISSING"   , add
label values Z3020 C3020
label variable Z3020 "ARE YOU CLOSE TO ANY POLITICAL PARTY?"
tab Z3020
***missing and complicated cases
recode Z3020 (2=5)
recode Z3020 (0=9)
mvdecode Z3020, mv(6, 7, 8, 9)
tab Z3020

***current elections did respondent cast a ballot
tab A2028
tab B3004_1
tab C3021_1
generate Z3021=.
replace Z3021=A2028 if A1003~=.
replace Z3021=B3004_1 if B1003~=.
replace Z3021=C3021_1 if C1003~=.
label values Z3021 C3020
label variable Z3021 "CURRENT ELECTIONS DID RESPONDENT CAST A BALLOT"
tab Z3021
***crap YES/NOs will require some hefty recodes here
***what do to with inconsistent stuff?
mvdecode Z3021, mv(0, 4, 6, 7, 8, 9)
recode Z3021 (2=5)
tab Z3021


***left/right self
tab A3031
tab B3045
tab C3013
generate Z3013=.
replace Z3013=A3031 if A1003~=.
replace Z3013=B3045 if B1003~=.
replace Z3013=C3013 if C1003~=.
label variable Z3013 "LEFT-RIGHT SELF"
label values Z3013 C3013_
tab Z3013
***missing and complicated cases
mvdecode Z3013, mv(95, 96, 97, 98, 99)
tab Z3013

***like dislike party A (USUALLY WINNER PARTY)
tab A3020_A
tab B3037_A
tab C3009_A
generate Z3014=.
replace Z3014=A3020_A if A1003~=.
replace Z3014=B3037_A if B1003~=.
replace Z3014=C3009_A if C1003~=.
label variable Z3014 "LIKE-DISLIKE PARTY A"
label define C3009_   0  "00. STRONGLY DISLIKE"   , add
label define C3009_   10 "10. STRONGLY LIKE"   , add
label define C3009_   96 "96. HAVEN'T HEARD OF PARTY"   , add
label define C3009_   97 "97. REFUSED"   , add
label define C3009_   98 "98. DON'T KNOW" , add
label define C3009_   99 "99. MISSING"   , add
label values Z3014 C3009_
tab Z3014
***missing and complicated cases
mvdecode Z3014, mv(95, 96, 97, 98, 99)
tab Z3014



****POLITICAL KNOWLEDGE
****variable names, there are 6
*tab A2023, missing
*tab A2024, missing
*tab A2025, missing
*tab B3047_1, missing 
*tab B3047_2, missing 
*tab B3047_3, missing
*tab C3036_1, missing 
*tab C3036_2, missing 
*tab C3036_3, missing

**political information items, version I
***now this is tricker since there are 3 items per wave. I think we should recode
***the dont knows into incorrect as to not lose these cases.
***second thing I did with these is to code incorrects 0 so that we can build a scale from 0 to 3 on these items

tab A2023, missing
tab A2024, missing
tab A2025, missing
generate A2023b=A2023
generate A2024b=A2024
generate A2025b=A2025
recode A2023b (8=0) (2=0)
recode A2024b (8=0) (2=0)
recode A2025b (8=0) (2=0)
mvdecode A2023b, mv(9)
mvdecode A2024b, mv(9)
mvdecode A2025b, mv(9)
tab A2023b
tab A2024b
tab A2025b
generate A2025c= (A2023b+A2024b+A2025b)/3
tab A2025c

***module 2 has some refused, I will lump them with DKs as incorrect
tab B3047_1 
tab B3047_2 
tab B3047_3
generate B3047_1b=B3047_1
generate B3047_2b=B3047_2
generate B3047_3b=B3047_3
recode B3047_1b (7=0) (8=0) (2=0)
recode B3047_2b (7=0) (8=0) (2=0)
recode B3047_3b (7=0) (8=0) (2=0)
mvdecode B3047_1b, mv(9)
mvdecode B3047_2b, mv(9)
mvdecode B3047_3b, mv(9)
tab B3047_1b
tab B3047_2b
tab B3047_3b
generate B3047_1c=(B3047_1b+B3047_2b+B3047_3b)/3
tab B3047_1c

***module 3, same as module 2 for some of the junk
tab C3036_1 
tab C3036_2 
tab C3036_3
generate C3036_1b=C3036_1 
generate C3036_2b=C3036_2 
generate C3036_3b=C3036_3 
***not the same code
recode C3036_1b (7=0) (8=0) (5=0)
recode C3036_2b (7=0) (8=0) (5=0)
recode C3036_3b (7=0) (8=0) (5=0)
mvdecode C3036_1b, mv(9)
mvdecode C3036_2b, mv(9)
mvdecode C3036_3b, mv(9)
tab C3036_1b 
tab C3036_2b
tab C3036_3b
generate C3036_1c=(C3036_1b+C3036_2b+C3036_3b)/3
tab C3036_1c

***module 4, 
*tab D3025_1_A
*tab D3025_2_A
*tab D3025_3_A
*tab D3025_4_A
*generate D3036_1b=D3025_1_A 
*generate D3036_2b=D3025_2_A
*generate D3036_3b=D3025_3_A
*generate D3036_4b=D3025_4_A

*recode D3036_1b (7=0) (8=0) (5=0)
*recode D3036_2b (7=0) (8=0) (5=0)
*recode D3036_3b (7=0) (8=0) (5=0)
*recode D3036_4b (7=0) (8=0) (5=0)

*mvdecode D3036_1b, mv(9)
*mvdecode D3036_2b, mv(9)
*mvdecode D3036_3b, mv(9)
*mvdecode D3036_4b, mv(9)
*tab D3036_1b 
*tab D3036_2b
*tab D3036_3b
*tab D3036_4b
*generate D3036_1c=(D3036_1b+D3036_2b+D3036_3b+D3036_4b)/4

****ok the merged scale now
tab A2025c
tab B3047_1c
tab C3036_1c
*tab D3036_1c

****super nice with the same distributions, module 4 is out of sorts before of more q
*generate Z3036_1=.
*replace Z3036_1=A2025c if A1003~=.
*replace Z3036_1=B3047_1c if B1003~=.
*replace Z3036_1=C3036_1c if C1003~=.
*replace Z3036_1=D3036_1c if D1003~=.
*label variable Z3036_1 "POLITICAL SOPHISTICATION SCALE 0-1 NUMOF CORRECT RESPONSES MODULES 1-4"
*tab Z3036_1, missing

****super nice with the same distributions
generate Z3036_1b=.
replace Z3036_1b=A2025c if A1003~=.
replace Z3036_1b=B3047_1c if B1003~=.
replace Z3036_1b=C3036_1c if C1003~=.
label variable Z3036_1b "POLITICAL SOPHISTICATION SCALE 0-1 NUMOF CORRECT RESPONSES MODULES 1-3"
tab Z3036_1b, missing

***dropping the components
drop A2023b
drop A2024b
drop A2025b
drop A2025c
drop B3047_1b
drop B3047_2b
drop B3047_3b
drop B3047_1c
drop C3036_1b 
drop C3036_2b
drop C3036_3b
drop C3036_1c
*drop D3036_1b 
*drop D3036_2b 
*drop D3036_3b 
*drop D3036_4b
*drop D3036_1c

*political information items, version II
***political expression scale credits respondents for expressing a view: in this 
***approach, definite answers, either correct or incorrect, are scored 1, and DKs 
***are given the score 0

tab A2023, missing
tab A2024, missing
tab A2025, missing
tab A2023
tab A2024
tab A2025
generate A2023b=A2023
generate A2024b=A2024
generate A2025b=A2025
recode A2023b (2=1) (8=0)
recode A2024b  (2=1)(8=0)
recode A2025b  (2=1)(8=0)
*mvdecode A2023b, mv(8)
*mvdecode A2024b, mv(8)
*mvdecode A2025b, mv(8)
tab A2023b
tab A2024b
tab A2025b
generate A2025d= (A2023b+A2024b+A2025b)/3
tab A2025d, m


***module 2 has some refused, I will lump them with DKs 
tab B3047_1 
tab B3047_2 
tab B3047_3
generate B3047_1b=B3047_1
generate B3047_2b=B3047_2
generate B3047_3b=B3047_3
recode B3047_1b (7=0) (8=0) (2=1)
recode B3047_2b (7=0) (8=0) (2=1)
recode B3047_3b (7=0) (8=0) (2=1)
mvdecode B3047_1b, mv(9)
mvdecode B3047_2b, mv(9)
mvdecode B3047_3b, mv(9)
tab B3047_1b
tab B3047_2b
tab B3047_3b
generate B3047_1d=(B3047_1b+B3047_2b+B3047_3b)/3
tab B3047_1d, m

***module 3, same as module 2 for some of the junk
tab C3036_1 
tab C3036_2 
tab C3036_3
generate C3036_1b=C3036_1 
generate C3036_2b=C3036_2 
generate C3036_3b=C3036_3 
***not the same code
recode C3036_1b (7=0) (8=0) (5=1)
recode C3036_2b (7=0) (8=0) (5=1)
recode C3036_3b (7=0) (8=0) (5=1)
mvdecode C3036_1b, mv(9)
mvdecode C3036_2b, mv(9)
mvdecode C3036_3b, mv(9)
tab C3036_1b 
tab C3036_2b
tab C3036_3b
generate C3036_1d=(C3036_1b+C3036_2b+C3036_3b)/3  
tab C3036_1d if C1003~=., m

***module 4, 
*tab D3025_1_A
*tab D3025_2_A
*tab D3025_3_A
*tab D3025_4_A
*generate D3036_1b=D3025_1_A 
*generate D3036_2b=D3025_2_A
*generate D3036_3b=D3025_3_A
*generate D3036_4b=D3025_4_A
*recode D3036_1b (7=0) (8=0) (5=1)
*recode D3036_2b (7=0) (8=0) (5=1)
*recode D3036_3b (7=0) (8=0) (5=1)
*recode D3036_4b (7=0) (8=0) (5=1)
*mvdecode D3036_1b, mv(9)
*mvdecode D3036_2b, mv(9)
*mvdecode D3036_3b, mv(9)
*mvdecode D3036_4b, mv(9)
*tab D3036_1b 
*tab D3036_2b
*tab D3036_3b
*tab D3036_4b
*generate D3036_1c=(D3036_1b+D3036_2b+D3036_3b+D3036_4b)/4
*tab D3036_1c if D1003~=., m

****ok the merged scale now, for all modules
*tab A2025d
*tab B3047_1d
*tab C3036_1d
*tab D3036_1c
*generate Z3036_2=.
*replace Z3036_2=A2025d if A1003~=.
*replace Z3036_2=B3047_1d if B1003~=.
*replace Z3036_2=C3036_1d if C1003~=.
*replace Z3036_2=D3036_1c if D1003~=.
*label variable Z3036_2 "POLITICAL SOPHISTICATION SCALE 0-1 EXPRESSION Modl 1-4"
*tab Z3036_2, m

***modules 1-3
generate Z3036_2b=.
replace Z3036_2b=A2025d if A1003~=.
replace Z3036_2b=B3047_1d if B1003~=.
replace Z3036_2b=C3036_1d if C1003~=.
label variable Z3036_2b "POLITICAL SOPHISTICATION SCALE 0-1 EXPRESSION Modl 1-3"
tab Z3036_2b, m

***dropping the components
drop A2023b
drop A2024b
drop A2025b
drop A2025d
drop B3047_1b
drop B3047_2b
drop B3047_3b
drop B3047_1d
drop C3036_1b 
drop C3036_2b
drop C3036_3b
drop C3036_1d
*drop D3036_1b 
*drop D3036_2b 
*drop D3036_3b 
*drop D3036_4b
*drop D3036_1c

*political information items, version III 
***the political accuracy scale compiles the proportion of the expressed opinions 
***that are correct in order to address the concern that women and men�s propensity 
***to guess is different. For example, a respondent getting one correct and one 
***incorrect and answering don�t know to one item would score 50 percent
tab A2023 if A1003~=., m
tab A2024 if A1003~=., m
tab A2025 if A1003~=., m
tab A2023
tab A2024
tab A2025
generate A2023b=A2023
generate A2024b=A2024
generate A2025b=A2025
recode A2023b (2=0) (8=100)
recode A2024b  (2=0)(8=100)
recode A2025b  (2=0)(8=100)
*mvdecode A2023b, mv(8)
*mvdecode A2024b, mv(8)
*mvdecode A2025b, mv(8)
tab A2023b
tab A2024b
tab A2025b
generate A2025d= (A2023b+A2024b+A2025b)
tab A2025d, m
generate A2025e=.
replace A2025e = 0 if A2025d==0
replace A2025e = 0.33 if A2025d==1
replace A2025e = 0.66 if A2025d==2
replace A2025e = 1 if A2025d==3
replace A2025e = 0 if A2025d==100
replace A2025e = 0.5 if A2025d==101
replace A2025e = 1 if A2025d==102
replace A2025e = 0 if A2025d==200
replace A2025e = 1 if A2025d==201
replace A2025e = . if A2025d==300
tab A2025e if A1003~=., m


***module 2 has some refused, I will lump them with DKs 
tab B3047_1 
tab B3047_2 
tab B3047_3
generate B3047_1b=B3047_1
generate B3047_2b=B3047_2
generate B3047_3b=B3047_3
recode B3047_1b (7=100) (8=100) (2=0)
recode B3047_2b (7=100) (8=100) (2=0)
recode B3047_3b (7=100) (8=100) (2=0)
mvdecode B3047_1b, mv(9)
mvdecode B3047_2b, mv(9)
mvdecode B3047_3b, mv(9)
tab B3047_1b
tab B3047_2b
tab B3047_3b
generate B3047_1d=(B3047_1b+B3047_2b+B3047_3b)
tab B3047_1d if B1003~=., m
generate B2025e=.
replace B2025e = 0 if B3047_1d==0
replace B2025e = 0.33 if B3047_1d==1
replace B2025e = 0.66 if B3047_1d==2
replace B2025e = 1 if B3047_1d==3
replace B2025e = 0 if B3047_1d==100
replace B2025e = 0.5 if B3047_1d==101
replace B2025e = 1 if B3047_1d==102
replace B2025e = 0 if B3047_1d==200
replace B2025e = 1 if B3047_1d==201
replace B2025e = . if B3047_1d==300
tab B2025e if B1003~=., m


***module 3, same as module 2 for some of the junk
tab C3036_1 
tab C3036_2 
tab C3036_3
generate C3036_1b=C3036_1 
generate C3036_2b=C3036_2 
generate C3036_3b=C3036_3 
***not the same code
recode C3036_1b (7=100) (8=100) (5=0)
recode C3036_2b (7=100) (8=100) (5=0)
recode C3036_3b (7=100) (8=100) (5=0)
mvdecode C3036_1b, mv(9)
mvdecode C3036_2b, mv(9)
mvdecode C3036_3b, mv(9)
tab C3036_1b 
tab C3036_2b
tab C3036_3b
generate C3036_1d=(C3036_1b+C3036_2b+C3036_3b) 
tab C3036_1d if C1003~=., m
generate C3036e=.
replace C3036e = 0 if C3036_1d==0
replace C3036e = 0.33 if C3036_1d==1
replace C3036e = 0.66 if C3036_1d==2
replace C3036e= 1 if C3036_1d==3
replace C3036e = 0 if C3036_1d==100
replace C3036e = 0.5 if C3036_1d==101
replace C3036e = 1 if C3036_1d==102
replace C3036e = 0 if C3036_1d==200
replace C3036e = 1 if C3036_1d==201
replace C3036e = . if C3036_1d==300
tab C3036e if C1003~=., m


***module 4, 
*tab D3025_1_A
*tab D3025_2_A
*tab D3025_3_A
*tab D3025_4_A
*generate D3036_1b=D3025_1_A 
*generate D3036_2b=D3025_2_A
*generate D3036_3b=D3025_3_A
*generate D3036_4b=D3025_4_A
*recode D3036_1b (7=100) (8=100) (5=0)
*recode D3036_2b (7=100) (8=100) (5=0)
*recode D3036_3b (7=100) (8=100) (5=0)
*recode D3036_4b (7=100) (8=100) (5=0)
*mvdecode D3036_1b, mv(9)
*mvdecode D3036_2b, mv(9)
*mvdecode D3036_3b, mv(9)
*mvdecode D3036_4b, mv(9)
*tab D3036_1b 
*tab D3036_2b
*tab D3036_3b
*tab D3036_4b
*generate D3036_1c=(D3036_1b+D3036_2b+D3036_3b+D3036_4b)
*tab D3036_1c if D1003~=., m
*generate D3036d=.
*replace D3036d = 0    if D3036_1c==0
*replace D3036d = 0.25 if D3036_1c==1
*replace D3036d = 0.5  if D3036_1c==2
*replace D3036d = 0.75 if D3036_1c==3
*replace D3036d = 1    if D3036_1c==4
*replace D3036d = 0    if D3036_1c==100
*replace D3036d = 0.33 if D3036_1c==101
*replace D3036d = 0.66 if D3036_1c==102
*replace D3036d = 1    if D3036_1c==103
*replace D3036d = 0    if D3036_1c==200
*replace D3036d = 0.5  if D3036_1c==201
*replace D3036d = 1    if D3036_1c==202
*replace D3036d = 0    if D3036_1c==300
*replace D3036d = 1    if D3036_1c==301
*replace D3036d = .    if D3036_1c==400



****ok the merged scale now, for all modules
*tab A2025e
*tab B2025e
*tab C3036e
*tab D3036d
*generate Z3036_3=.
*replace Z3036_3=A2025e if A1003~=.
*replace Z3036_3=B2025e if B1003~=.
*replace Z3036_3=C3036e if C1003~=.
*replace Z3036_3=D3036d if D1003~=.
*label variable Z3036_3 "POLITICAL SOPHISTICATION SCALE 0-1 % ACCURACY Modl 1-4"
*tab Z3036_3, m

***modules 1-3
generate Z3036_3b=.
replace Z3036_3b=A2025e if A1003~=.
replace Z3036_3b=B2025e if B1003~=.
replace Z3036_3b=C3036e if C1003~=.
label variable Z3036_3b "POLITICAL SOPHISTICATION SCALE 0-1 % ACCURACY Modl 1-3"
tab Z3036_3b, m

***dropping the components
drop A2023b A2024b A2025b A2025d A2025e B3047_1b B3047_2b B3047_3b B3047_1d B2025e C3036_1b C3036_2b C3036_3b C3036_1d C3036e 
*drop D3036_1b D3036_2b D3036_3b D3036_4b D3036_1c D3036d

*************************************************************************************
***PLACEMENT SCALES (in another file if necessary)





